"""
@Author: marco
@Date: 2021-6-18 16:50:03
@description:
@LastEditors  : marco
@LastEditTime : 2021-6-18 16:50:03
"""
import json
import os


def init(name):
    """
    初始化运行环境
    @param  name
    return void
    """
    path = os.getcwd() + '/.runtime/environment.json'
    data = {"environment": name}
    with open(path, "w+") as f:
        f.write(json.dumps(data))


def read() -> dict:
    """ 读取环境变量
        return dict enviroment
    """
    with open(os.getcwd() + '/.runtime/environment.json', "r") as f:
        environment = json.loads(f.read())['environment']
        return environment
